package bpm.dao.impl.fs;

import java.sql.Date;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

import org.springframework.jdbc.core.BatchPreparedStatementSetter;

import bpm.domain.fs.Container;

public class ContainerSynchronizationBatchPreparedStatementSetter implements
		BatchPreparedStatementSetter {
	private List<Container> containers;
	
	public ContainerSynchronizationBatchPreparedStatementSetter() {}
	public ContainerSynchronizationBatchPreparedStatementSetter(List<Container> containers) {
		this.containers = containers;
	}
	
	public int getBatchSize() {
		return containers.size();
	}
	public void setValues(PreparedStatement pstmt, int i) throws SQLException {
		pstmt.setLong(1, containers.get(i).getFree());
		pstmt.setString(2, containers.get(i).getEnableString());
		pstmt.setDate(3, new Date(containers.get(i).getLastUpdateTime().getTime()));
		pstmt.setString(4, containers.get(i).getDescription());
		pstmt.setInt(5, containers.get(i).getId());
	}
}
